import { IsInt, IsNotEmpty, IsOptional } from 'class-validator';
import { ApiProperty } from "@nestjs/swagger";

export class OperationLogAddDto {
    @ApiProperty({
        description: '用户id',
        type:String,
    })
    @IsNotEmpty({ message: '用户id' })
    uid: string|number;

    @ApiProperty({
        description: '请求参数',
        type:String,
    })
    @IsOptional({ message: '请求参数' })
    requestParams?: string;

    @ApiProperty({
        description: '用户操作具体内容',
        type:String,
    })
    @IsOptional({ message: '用户操作具体内容' })
    operationContent?: string;

    @ApiProperty({
        description: '请求Url',
        type:String,
    })
    @IsOptional({ message: '请求Url' })
    requestUrl: any;

    @ApiProperty({
        description: '请求Ip',
        type:String,
    })
    @IsOptional({ message: '请求Ip' })
    requestIp: string;

    @ApiProperty({
        description: '请求方法',
        type:String,
    })
    @IsOptional({ message: '请求方法 POST GET PUT DELETE等' })
    requestMethod: any;

    @ApiProperty({
        description: '响应参数',
        type:String,
    })
    @IsOptional({ message: '响应参数' })
    respondParams: string;

    @ApiProperty({
        description: '操作系统',
        type:String,
    })
    @IsOptional()
    operationSystem: string;

    @ApiProperty({
        description: '操作浏览器',
        type:String,
    })
    @IsOptional()
    browser: any;

    @ApiProperty({
        description: '电话操作，手机操作',
        type:Number,
    })
    @IsInt()
    @IsOptional()
    isPcOrIphone: number;

    @ApiProperty({
        description: '操作类型',
        type:Number,
    })
    @IsInt()
    @IsOptional({message:"操作类型"})
    operationType: number;
}
